# UDP客户端
from socket import *
import time

# 创建套接字
socket_udp = socket(AF_INET, SOCK_DGRAM)

socket_ip = "192.168.31.45"

socket_port = 1234

socket_date = "liuzewen"

# encode编码
# decode解码
# 发送数据
while True:
    time.sleep(0.3)
    # utf-8国际编码,gb2312是中国的编码
    socket_udp.sendto(socket_date.encode("gb2312"), (socket_ip, socket_port))
